package com.ten.jinxiancun.controller;

import com.ten.jinxiancun.server.impl.InventoryServerImpl;
import com.ten.jinxiancun.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
/*
* 仓库文件控制层*/
@RestController
@RequestMapping("/inventory")
public class inventoryController {
    @Autowired
    InventoryServerImpl isi;
        @RequestMapping("/gatAllInventory")
    public Object gatAllInventory(@RequestParam Map<String,Object> map, @RequestParam Integer limit, @RequestParam Integer page){
        map.put("limit",limit);
        map.put("page",(page-1)*limit);
        Result res= new Result("0","true",isi.inventoryCountFind(map),isi.gatAllInventory(map));
        return res;
    }
    @RequestMapping("/incentoryadd")
    public Object incentoryadd(@RequestParam Map<String,Object> map){
            Result res= new Result("0","true",isi.inventoryadd(map),true);
            return res;
    }
    @RequestMapping("/incentoryUpdate")
    public Object incentoryUpdate(@RequestParam Map<String,Object> map){
            Result res = new Result("0","true",isi.inventoryupdate(map),true);
            return res;
    }
    @RequestMapping("/incentorydel")
    public Object incentorydel(@RequestParam("Id") Integer Id){
            Result res =new Result("0","true",isi.inventorydel(Id),true);
            return res;
    }
}
